package TeleRobot;

public class Point extends java.awt.Point {
    public double x;
    public double y;
    
    
    Point(double x, double y)
    {
        this.x = x;
        this.y = y;
    }

    public Point(java.awt.Point input_point)
    {
        this.x = input_point.x;
        this.y = input_point.y;
    }
        
    public void set(Point p)
    {
        x = p.x;
        y = p.y;
    }
    
    public double length()
    {
        double vector_length;
        vector_length = Math.sqrt((x*x) + (y*y));
        return vector_length;
    }
    
    public double lengthfrom(Point origin_point)
    {
        double vector_length;
        double x_offset = x - origin_point.x;
        double y_offset = y - origin_point.y;
        vector_length = Math.sqrt((x_offset * x_offset) + (y_offset*y_offset));
        return vector_length;
    }
    
    @Override
    public Point clone()
    {
         return new Point(x,y);
    }
    
    @Override
    public String toString()
    {
        StringBuilder result = new StringBuilder();
        String NEW_LINE = System.getProperty("line.separator");
        result.append("(" + (int)x + "," + (int)y + ")");
        return result.toString();
    }
}
